//
//  SellerPreFectureTableViewController.m
//  EasyToTesco2.0
//
//  Created by 袖手旁觀 on 16/6/21.
//  Copyright © 2016年 EasyToTesco. All rights reserved.
//

#import "SellerPreFectureTableViewController.h"
#import "SellerCooperateTableViewController.h"
#import "TurnOverItemizedTableViewController.h"
#import "TurnOverBalanceTableViewController.h"
#import "cooperateRecodeViewController.h"

@interface SellerPreFectureTableViewController ()

@property (nonatomic,strong)NSArray *sellerArray;

@end

static NSString *const reuseIdentifier = @"reuseIdentifier";

@implementation SellerPreFectureTableViewController

- (NSArray *)sellerArray {
    if (!_sellerArray) {
        _sellerArray = @[@"商家合作专区",@"合作记录",@"营业额结算",@"营业额结算明细"];
    }
    return _sellerArray;
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:NO animated:YES];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"商家专区";
    
    self.tableView.backgroundColor = BACKGROUND_COLOR;
    self.tableView.tableFooterView = [[UIView alloc] init];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.sellerArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier];
    
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier];
        
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.textLabel.font = FONT(15);
    }
    
    cell.textLabel.text = self.sellerArray[indexPath.row];
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.row == 0) {
        SellerCooperateTableViewController *cooperate = [[SellerCooperateTableViewController alloc] init];
        [self.navigationController pushForm:self.navigationController pushToAndHidden:cooperate];
        
    } else if (indexPath.row == 3) {
        TurnOverItemizedTableViewController *itemized = [[TurnOverItemizedTableViewController alloc] init];
        [self.navigationController pushForm:self.navigationController pushToAndHidden:itemized];
    } else if (indexPath.row == 2) {
        TurnOverBalanceTableViewController *balance = [[TurnOverBalanceTableViewController alloc] init];
        [self.navigationController pushForm:self.navigationController pushToAndHidden:balance];
    } else if (indexPath.row == 1) {
        cooperateRecodeViewController *cooperate = [[cooperateRecodeViewController alloc] init];
        [self.navigationController pushForm:self.navigationController pushToAndHidden:cooperate];
    }
}
@end
